package com.lucy.nepu.module.tmaterial.entity;

import com.lucy.common.converter.JpaColumnConverter;
import com.lucy.common.core.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "nepu_tmaterial")
public class TMaterial extends BaseEntity implements Serializable {
    @ApiModelProperty("周期ID")
    @Column(name = "period_id")
    String periodId;

    /**
     * 著作词典ID
     */
    @ApiModelProperty(value = "教材词典ID",notes = "")
    @Column(name = "tmaterial_dict_id")
    String tmaterialDictId;

    @ApiModelProperty(value = "教材名称",notes = "")
    @Column(name = "tmaterial_name")
    String tmaterialName;

    /**
     * 字数 单位（万字）
     */
    @ApiModelProperty(value = "字数",notes = "单位（万字）")
    @Column(name = "words_number",scale = 2)
    Double wordsNumber;

    /**
     * 出版时间
     */
    @ApiModelProperty(value = "出版时间")
    @Column(name = "publication_date")
    Date publicationDate;

    /**
     * 署名单位
     */
    @ApiModelProperty(value = "署名单位")
    @Column(name = "signature_unit")
    String signatureUnit;

    /**
     * 第一作者姓名
     */
    @ApiModelProperty(value = "第一作者",notes = "")
    @Column(name = "first_author")
    String firstAuthor;

    /**
     * 第一作者ID
     */
    @ApiModelProperty(value = "第一作者ID",notes = "")
    @Column(name = "first_author_id")
    Long firstAuthorId;

    /**
     * 参与人员ID
     */
    @ApiModelProperty(value = "教材成员ID列表",notes = "")
    @Convert(converter = JpaColumnConverter.class)
    @Column(name = "user_id_list")
    List<Long> userIdList;

    /**
     * 出版社
     */
    @ApiModelProperty(value = "出版社",notes = "")
    @Column(name = "publisher")
    String publisher;

    @ApiModelProperty(value = "工作量",notes = "")
    @Column(name = "workload",scale = 2)
    Double workload;

    /**
     * 关联文件列表
     */
    @Convert(converter = JpaColumnConverter.class)
    @ApiModelProperty(value = "关联文件ID列表")
    @Column(name = "file_ids")
    List<String> fileIds;

    /**
     * 0. 关闭状态 -- 可以删除
     * 1. 正常状态 -- 可以删除
     * 2. 已经登记工作量 -- 锁定无法操作
     */
    @ApiModelProperty("记录状态")
    @Column(name = "status")
    Integer status;
}
